//
//  FCOSSService.h
//  FCBaseKit
//
//  Created by sobey on 2020/2/6.
//  Copyright © 2020 Summer. All rights reserved.
// 阿里云上传服务

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <FCBaseKit/FCSRUploadModel.h>
#import <FCBaseKit/FCSRCommonTools.h>

/**
   注意，在调用服务之前，必须初始化上传服务
 */

NS_ASSUME_NONNULL_BEGIN

@interface FCOSSService : NSObject

+ (instancetype)shareInstance;

/**
    初始化上传服务
    @param oss_ststoken_url sts授权服务器的地址
    @param oss_endpoint 访问的阿里云endpoint（域名）
    @param oss_bucket_name bucket名称
    @param oss_image_endpoint 文件的域名

 */
- (void)configClient:(NSString *)oss_ststoken_url oss_endpoint:(NSString *)oss_endpoint oss_bucket_name:(NSString *)oss_bucket_name oss_image_endpoint:(NSString *)oss_image_endpoint;


/**
 *     上传图片 通过缓存路径
 *     @param objectKey 图片的名字
 *     @param filePath 图片缓存路径
 */
//- (void)asyncPutImageWithObjectKey:(NSString *)objectKey
//                     localFilePath:(NSString *)filePath
//                          progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
//                           success:(void (^_Nullable)(NSString* objectKey))success
//                           failure:(void (^_Nullable)(NSError* error))failure;


/**
 *  上传单张图片 通过图片data
 *     @param objectKey 图片的名字
 *     @param uploadData 图片data
 */
- (void)asyncPutImageWithObjectKey:(NSString *)objectKey
                        uploadData:(NSData *)uploadData
                          progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
                           success:(void (^_Nullable)(NSString* objectKey))success
                           failure:(void (^_Nullable)(NSError* error))failure;

/**
 *  上传多张图片 通过图片数组data
 *     @param objectKey 图片的名字
 *     @param uploadImageDatas 图片数组data
 */
- (void)asyncPutImageArrayWithObjectKey:(NSString *)objectKey
                        uploadImageDatas:(NSArray<NSData *> *)uploadImageDatas
                          progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
                           success:(void (^_Nullable)(NSArray* objectKeys))success
                           failure:(void (^_Nullable)(NSError* error))failure;



/**
 *  下载单个图片
 */
//- (void)asyncGetImage:(NSString *)objectKey
//             progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
//              success:(void (^_Nullable)(NSString *path))success
//              failure:(void (^_Nullable)(NSError*))failure;


/**
  上传视频 通过文件路径
 *     @param objectKey 视频的名字
 *     @param filePath 视频缓存地址
 */
//- (void)asyncPutVedioWithObjectKey:(NSString *)objectKey
//                     localFilePath:(NSString *)filePath
//                          progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
//                           success:(void (^_Nullable)(NSString* objectKey))success
//                           failure:(void (^_Nullable)(NSError* error))failure;


/**
 *  上传视频 通过data
 *     @param objectKey 视频的名字
 *     @param uploadData 视频data
 */
- (void)asyncPutVedioWithObjectKey:(NSString *)objectKey
                        uploadData:(NSData *)uploadData
                          progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
                           success:(void (^_Nullable)(NSString* objectKey))success
                           failure:(void (^_Nullable)(NSError* error))failure;
/**
 *  下载单个视频文件
 */
//- (void)asyncGetVedio:(NSString *)objectKey
//             progressBlock:(void (^_Nullable)(CGFloat prorgess))progressBlock
//              success:(void (^_Nullable)(NSString *path))success
//              failure:(void (^_Nullable)(NSError*))failure;


#pragma mark - 通过数组里面放FCSRUploadModel模型,上传多张图片和视频

- (void)asyncPutModelArrayWithObjectKey:(NSString *)objectKey
modelArray:(NSArray<FCSRUploadModel *> *)modelArray
  progressBlock:(void (^_Nullable)(CGFloat progress))progressBlock
   success:(void (^_Nullable)(NSArray *paths))success
                                failure:(void (^_Nullable)(NSError* error))failure;

@end

NS_ASSUME_NONNULL_END
